package pw.hais.zongcaibook.activity;

import android.os.Bundle;

import pw.hais.utils.L;
import pw.hais.zongcaibook.R;
import pw.hais.zongcaibook.app.BaseActivity;
import pw.hais.zongcaibook.app.HaisApp;

public class MainActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    private long exitTime = 0;

    @Override
    public void onBackPressed() {
        if ((System.currentTimeMillis() - exitTime) > 2000) {
            L.showShort("再次按返回键退出 " + getResources().getString(R.string.app_name));
            exitTime = System.currentTimeMillis();
        } else {
            ((HaisApp)getApplication()).exitApp();
        }
    }
}
